Partial Class Admin_Default
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        authenticate(Me.PasswordBox.Text)
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Me.IsPostBack Then _
            authenticate(Me.PasswordBox.Text)
    End Sub

    Sub authenticate(ByVal Password As String)

        Dim UserName As String = "tony"

        If FormsAuthentication.Authenticate(UserName, Password) Then
            FormsAuthentication.RedirectFromLoginPage(UserName, False)
            Response.Redirect("AdminOptions.aspx")
            lblMessage.Visible = False
        Else
            ' Invalid credentials supplied, display message
            lblMessage.Visible = True
        End If

    End Sub

End Class

